﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"]</title>
    <link href="~/js/bootstrap-table.min.css" rel="stylesheet" />
    <link href="~/css/bootstrap.css" rel="stylesheet" />
    <link href="~/css/bootstrap-icons.css" rel="stylesheet" />
    <link rel="stylesheet" href="~/css/site.css" />
    <link href="~/css/LightBlueSkin.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="~/lib/jquery/dist/jquery.datetimepicker.css" />
</head>
<body>
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-1 pl-2 pr-0 font-rfs pre-scrollable" style="background-color:#5b6c97;min-height:100vh;">
                <ul class="nav navbar-nav">
                    <li style="margin-bottom:0em; min-height:5vh">
                        <p style="margin-bottom:0em; text-align:center;margin-left:-10px;">
                            <font color="white" style="font-weight:bold;font-size:calc(0.8em + 0.5vw);">EasyLims</font>
                        </p>
                    </li>
                    <li class="nav-item">
                        <a id="aruntime" class="nav-link" href="#SampleLogin" data-toggle="collapse" aria-expanded="false" style="color:white;">
                            <p class="font-rfs" style="margin-bottom:0em;">
                                <i class="bi-caret-right-square">&nbsp</i>
                                运行时
                                <i class="bi-chevron-right"></i>
                            </p>
                        </a>
                        <ul class="collapse list-unstyled font-rfs show" id="SampleLogin">
                            <li>
                                <div class="input-group">
                                    <div class="col-9 pr-0 pl-0">
                                        <a asp-controller="Sample" asp-action="SampleLogin" target="_blank" class="active" style="color: white">
                                            <p class="font-rfs layout_menu_item">样品登录</p>
                                        </a>
                                    </div>
                                    <div class="col-3 pl-0 input-group">
                                        <a id="aSampleLogin" style="color:white"></a>                                   
                                    </div>
                                </div>
                            </li>
                            <li id="liSampling">
                                <div class="input-group">
                                    <div class="col-9 pr-0 pl-0">
                                        <a asp-controller="Sample" asp-action="Sampling" target="_blank" class="active" style="color: white">
                                            <p class="font-rfs layout_menu_item">采样</p>
                                        </a>
                                    </div>
                                    <div class="col-3 pl-0 input-group">
                                        <a id="aSampling" style="color:white;"></a>                                   
                                    </div>
                                </div>
                            </li>
                            <li id="liReceiveSamples">
                                <div class="input-group">
                                    <div class="col-9 pr-0 pl-0">
                                        <a asp-controller="Sample" asp-action="ReceiveSamples" target="_blank" class="active" style="color: white">
                                            <p class="font-rfs layout_menu_item">接收</p>
                                        </a>
                                    </div>
                                    <div class="col-3 pl-0 input-group">
                                        <a id="aReceiveSamples" style="color:white"></a>                                   
                                    </div>
                                </div>
                            </li>
                            <li id="liResultEntry">
                                <div class="input-group">
                                    <div class="col-9 pr-0 pl-0">
                                        <a asp-controller="Sample" asp-action="ResultEntry" target="_blank" class="active" style="color: white">
                                            <p class="font-rfs layout_menu_item">结果录入</p>
                                        </a>
                                    </div>
                                    <div class="col-3 pl-0 input-group">
                                        <a id="aResultEntry" style="color:white"></a>                                   
                                    </div>
                                </div>
                            </li>
                            <li id="litjsh">
                                <div class="input-group">
                                    <div class="col-9 pr-0 pl-0">
                                        <a asp-controller="Sample" asp-action="ExamineAndVerify" asp-route-StepName="同级审核" target="_blank" class="active" style="color: white">
                                            <p class="font-rfs layout_menu_item">同级审核</p>
                                        </a>
                                    </div>
                                    <div class="col-3 pl-0 input-group">
                                        <a id="aExamineAndVerify" style="color:white"></a>                                   
                                    </div>
                                </div>
                            </li>
                            <li id="liQA">
                                <div class="input-group">
                                    <div class="col-9 pr-0 pl-0">
                                        <a asp-controller="Sample" asp-action="ExamineAndVerify" asp-route-StepName="QA审核" target="_blank" class="active" style="color: white">
                                            <p class="font-rfs layout_menu_item">QA审核</p>
                                        </a>
                                    </div>
                                    <div class="col-3 pl-0 input-group">
                                        <a id="qaExamineAndVerify" style="color:white"></a>
                                    </div>
                                </div>
                            </li>
                            <li id="liManager">
                                <div class="input-group">
                                    <div class="col-9 pr-0 pl-0">
                                        <a asp-controller="Sample" asp-action="ExamineAndVerify" asp-route-StepName="经理审核" target="_blank" class="active" style="color: white">
                                            <p class="font-rfs layout_menu_item">经理审核</p>
                                        </a>
                                    </div>
                                    <div class="col-3 pl-0 input-group">
                                        <a id="maExamineAndVerify" style="color:white"></a>
                                    </div>
                                </div>
                            </li>
                        </ul>
                        <a id="aSampleManager" class="active" asp-controller="Sample" asp-action="SampleManager" target="_blank" style="color:white;text-decoration: none;">
                            <p class="font-rfs" style="margin-bottom:0em;margin-top: 0.5rem;">
                                <i class="bi-card-checklist">&nbsp</i>
                                样品管理
                            </p>
                        </a>
                        <a id="aEqManager" class="active" asp-controller="Eq" asp-action="EqManager" target="_blank" style="color:white;text-decoration: none;">
                            <p class="font-rfs" style="margin-bottom:0em;margin-top: 0.5rem;">
                                <i class="bi-pc-display-horizontal">&nbsp</i>
                                设备管理
                            </p>
                        </a>
                        <a id="aEnvMonitoring" class="active" asp-controller="Common" asp-action="EnvMonitoring" target="_blank" style="color:white;text-decoration: none;">
                            <p class="font-rfs" style="margin-bottom:0em;margin-top: 0.5rem;">
                                <i class="bi-diagram-3-fill">&nbsp</i>
                                环境监测
                            </p>
                        </a>
                        <a id="aSiteGroup" class="active" asp-controller="Common" asp-action="SiteGroup" target="_blank" style="color:white;text-decoration: none;">
                            <p class="font-rfs" style="margin-bottom:0em;margin-top: 0.5rem;">
                                <i class="bi-diagram-3-fill">&nbsp</i>
                                组织结构
                            </p>
                        </a>
                        <a id="aReagentManage" class="active" asp-controller="Reagent" asp-action="ReagentManage" target="_blank" style="color:white;text-decoration: none;">
                            <p class="font-rfs" style="margin-bottom:0em;margin-top: 0.5rem;">
                                <i class="bi-tags-fill">&nbsp</i>
                                试剂管理
                            </p>
                        </a>
                        <a class="active" asp-controller="Wiki" asp-action="WikiFileManager" target="_blank" style="color:white;text-decoration: none;">
                            <p class="font-rfs" style="margin-bottom:0em;margin-top: 0.5rem;">
                                <i class="bi-file-earmark-pdf">&nbsp</i>
                                文件管理
                            </p>
                        </a>
                        <a class="active" asp-controller="Common" asp-action="StatisticalQuerys" target="_blank" style="color:white;text-decoration: none;">
                            <p class="font-rfs" style="margin-bottom:0em;margin-top: 0.5rem;">
                                <i class="bi-search">&nbsp</i>
                                统计查询
                            </p>
                        </a>
                        <a class="active" asp-controller="Wiki" asp-action="WikiManager" target="_blank" style="color:white;text-decoration: none;">
                            <p class="font-rfs" style="margin-bottom:0em;margin-top: 0.5rem;">
                                <i class="bi-book">&nbsp</i>
                                帮助文档
                            </p>
                        </a>
                        <a id="aCommon" class="nav-link" href="#Common" data-toggle="collapse" aria-expanded="false" style="color:white;padding-bottom: 0px;">
                            <p class="font-rfs" style="margin-bottom:0em">
                                <i class="bi-globe">&nbsp</i>
                                公共资源
                                <i class="bi-chevron-right"></i>
                            </p>
                        </a>
                        <ul class="collapse list-unstyled font-rfs" id="Common">
                            <li>
                                <a asp-controller="Common" asp-action="Unit" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item" style="margin-top: 0.5rem;">单位管理</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="Common" asp-action="Supplier" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">客户管理</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="Common" asp-action="AreaAndLocation" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">区域位置</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="Common" asp-action="Monitoring" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">监测标准</p>
                                </a>
                            </li>
                        </ul>
                        <a id="aSampleDefine" class="nav-link" href="#BasicData" data-toggle="collapse" aria-expanded="false" style="color:white;padding-bottom: 0px;">
                            <p class="font-rfs" style="margin-bottom:0em">
                                <i class="bi-pencil-square">&nbsp</i>
                                样品定义
                                <i class="bi-chevron-right"></i>
                            </p>
                        </a>
                        <ul class="collapse list-unstyled font-rfs" id="BasicData">
                            <li>
                                <a asp-controller="Sample" asp-action="Analyte" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item" style="margin-top: 0.5rem;">分析项管理</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="Sample" asp-action="TestDefinition" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">测试管理</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="Sample" asp-action="Method" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">方法管理</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="Sample" asp-action="Spec" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">指标管理</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="Sample" asp-action="SpecCollection" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">指标集管理</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="Sample" asp-action="SampleDefinition" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">样品定义</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="Sample" asp-action="SampleGroup" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">样品组管理</p>
                                </a>
                            </li>
                        </ul>
                        <a id="aRetentionSample" class="nav-link" href="#RetentionSample" data-toggle="collapse" aria-expanded="false" style="color:white;padding-bottom: 0px;">
                            <p class="font-rfs" style="margin-bottom:0em;">
                                <i class="bi-save2">&nbsp</i>
                                留样管理
                                <i class="bi-chevron-right"></i>
                            </p>
                        </a>
                        <ul class="collapse list-unstyled font-rfs" id="RetentionSample">
                            <li>
                                <a asp-controller="Sample" asp-action="RetentionConfig" target="_blank" class="active" style="color: white;">
                                    <p class="font-rfs layout_menu_item" style="margin-top: 0.5rem;">留样配置</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="Sample" asp-action="RetentionSampleManage" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">留样管理</p>
                                </a>
                            </li>
                        </ul>
                        <a id="aUserManager" class="nav-link" href="#UserManager" data-toggle="collapse" aria-expanded="false" style="color:white;padding-bottom: 0px;">
                            <p class="font-rfs" style="margin-bottom:0em">
                                <i class="bi-person-square">&nbsp</i>
                                用户管理
                                <i class="bi-chevron-right"></i>
                            </p>
                        </a>
                        <ul class="collapse list-unstyled font-rfs" id="UserManager">
                            <li>
                                <a asp-controller="UserManager" asp-action="UserManager" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item" style="margin-top: 0.5rem;">用户管理</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="UserManager" asp-action="RolesManager" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">角色管理</p>
                                </a>
                            </li>
                        </ul>
                        <a id="aInvManager" class="nav-link" href="#InvManager" data-toggle="collapse" aria-expanded="false" style="color:white;padding-bottom: 0px;">
                            <p class="font-rfs" style="margin-bottom:0;">
                                <i class="bi-server">&nbsp</i>
                                库存管理
                                <i class="bi-chevron-right"></i>
                            </p>
                        </a>
                        <ul class="collapse list-unstyled font-rfs" id="InvManager">
                            <li>
                                <a asp-controller="Inv" asp-action="MaterialManager" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item" style="margin-top: 0.5rem;">物料管理</p>
                                </a>
                            </li>
                            <li>
                                <a asp-controller="Inv" asp-action="InvManager" target="_blank" class="active" style="color: white">
                                    <p class="font-rfs layout_menu_item">库存管理</p>
                                </a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
            <div class="col-md-11 px-0">
                <div class="col-md-12 px-0">
                    <nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow layout_navbar">
                        <div class=" col-md-4 navbar-collapse collapse d-sm-inline-flex">
                            <ul class="navbar-nav" style="text-align:left">
                                <li class="nav-item text-left">
                                    <a id="LoginUserName" class="font-rfs"></a>
                                </li>
                            </ul>
                        </div>
                        <div class=" col-md-8 navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
                            <ul class="navbar-nav">
                                <li class="nav-item text-right">
                                    <a class="nav-link text-dark" title="系统版本">
                                        <i id="LimsVersion" class="bi-question-circle" style="color:#007bff;"></i>
                                    </a>
                                </li>
                                <li class="nav-item text-right">
                                    <div class="dropdown">
                                        <a href="#" class="nav-link text-dark" id="MyMeassage" data-toggle="dropdown" title="我的消息">
                                            <i id="layout-bellfill" class="bi-bell-fill" style="color:coral; display:none"></i>
                                            <i id="layout-bell" class="bi-bell" style="color:coral; display:none"></i>
                                        </a>
                                        <ul id="layout-dropdownMenu" class="dropdown-menu" style="width:22rem; max-height: 100vh; overflow:auto; margin-left:-15rem;"></ul>
                                    </div>
                                </li>
                                <li class="nav-item text-right">
                                    <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Login" title="切换账户">
                                        <i class="bi-arrow-left-right" style="color:forestgreen;"></i>
                                    </a>
                                </li>
                                @* <li class="nav-item text-right">
                                    <a class="nav-link text-dark" asp-area="" asp-controller="UserManager" asp-action="LogOut" title="退出登录">
                                        <i class="bi-door-open-fill" style="color:#007bff;"></i>
                                    </a>
                                </li>  退出登录函数应该放到homscontroll中，可以参考获得用户角色组函数*@ 
                            </ul>
                        </div>
                    </nav>
                </div>
                <main role="main" class="layout_body">
                    @RenderBody()
                </main>
            </div>
        </div>
    </div>
    <div class="modal" id="Layout-Modal" role="dialog" aria-hidden="true" data-backdrop="static">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class='modal-header'>
                    <p id="Layout-Modal-modalTitle" class="pt-3 pl-3 font-rfs"></p>
                    <a data-dismiss="modal" class="modal-close">&times;</a>
                </div>
                <div class="modal-body">
                    <div id="Layout-Modal-Embed"></div>
                </div>
            </div>
        </div>
    </div>
    @*<footer class="border-top footer text-muted">
        <div class="container">
            &copy; 2021 - CoreLims - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
        </div>
    </footer>*@
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="~/lib/jquery/dist/jquery.datetimepicker.full.min.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
    <script src="~/js/site.js" asp-append-version="true"></script>
    <script src="~/js/bootstrap-table.min.js"></script>
    @RenderSection("Scripts", required: false)
    <script>
        $(document).ready(function () {
            GetLoginUser();
            CheckRemind();
            SetLayoutCounter();
            $("#MyMeassage").click(function () {
                $("#layout-dropdownMenu li").remove();

                $.post("/Common/GetMyRemind", {
                    //Type: type
                }, function (list) {
                    var re = new RegExp("\r\n", 'g');
                    list.forEach(function (item, index, list) {
                        $("#layout-dropdownMenu").append("<li class='input-group text-dark dropdown-header' style='padding-left: 10px;'>" +
                            "<a class='col-8' style='padding-left: 0px;'>" + item.title + "<br>" + item.createTime.replace('T', ' ').split('.')[0] + "</a>" +
                            "<a href='#' class='col-2' style='text-align: right; padding-right: 0px;' onclick='LayoutHandle(this);' data-id='" + item.id + "'>已读</a>"+
                            "<a href='#' class='col-2' style='text-align: right; padding-right: 0px;' onclick='LayoutApproval(this);' data-WorkFlowId='" + item.workFlowId + "'>审批</a></li>");
                        $("#layout-dropdownMenu").append("<li class='text-dark' style='padding-left: 10px;'>" + item.content.replace(/[\r\n]/g, "<br>") + "</li>");
                        $("#layout-dropdownMenu").append("<li><div class='dropdown-divider'></div></li>");
                    });
                });
            });

            $.when(GetUserRolesSt()).then(function (data) {
                if (data.indexOf("Admin") >= 0) {
                    return;
                }
                if (data.indexOf("Admin") == -1) {
                    $('#aEnvMonitoring').css('display', 'none'); 
                    $('#aSiteGroup').css('display', 'none'); 
                    $('#aCommon').css('display', 'none');
                    $('#Common').css('display', 'none');
                    $('#aUserManager').css('display', 'none');
                    $('#UserManager').css('display', 'none');
                }
                if (data.indexOf("分析员") == -1) {
                    $('#aruntime').css('display', 'none');
                    $('#liSampling').css('display', 'none');
                    $('#liReceiveSamples').css('display', 'none');
                    $('#liResultEntry').css('display', 'none');
                }
                if (data.indexOf("样品登录") == -1) {
                    $('#SampleLogin').hide();
                }
                if (data.indexOf("QA审核") == -1) {
                    $('#liQA').hide();
                }
                if (data.indexOf("经理审核") == -1) {
                    $('#liManager').hide();
                }
                if (data.indexOf("样品管理") == -1) {
                    $('#aSampleManager').css('display', 'none');
                } aEnvMonitoring
                if (data.indexOf("设备管理") == -1) {
                    $('#aEqManager').css('display', 'none');
                }
                if (data.indexOf("试剂管理") == -1) {
                    $('#aReagentManage').css('display', 'none');
                }
                if (data.indexOf("样品定义") == -1) {
                    $('#aSampleDefine').css('display', 'none');
                    $('#BasicData').css('display', 'none');
                }
                if (data.indexOf("留样管理") == -1) {
                    $('#aRetentionSample').css('display', 'none');
                    $('#RetentionSample').css('display', 'none');
                }
                if (data.indexOf("库存管理") == -1) {
                    $('#aInvManager').css('display', 'none');
                    $('#InvManager').css('display', 'none');
                }
            });
        });

        function LayoutRead(obj) {
            alert($(obj).attr('data-id'));
        }

        function LayoutHandle(obj) {
            $.post("/WorkFlow/MessageReadProcessing", {
                RemindId: $(obj).attr('data-id')
            }, function (data) {
            });
        }

        function LayoutApproval(obj) {
            $("#Layout-Modal-modalTitle").text("快捷审批");

            $("#Layout-Modal").modal({
                backdrop: 'static',
                keyboard: false
            });

            $.post("/WorkFlow/ExamineAndApprove", {
                WorkFlowId: $(obj).attr('data-workFlowId'),
                ModalID: "Layout-Modal"
            }, function (data) {
                $("#Layout-Modal-Embed").html(data);
            });
        }

        $("#LimsVersion").click(function () {
            $("#Layout-Modal-modalTitle").text("系统版本信息");

            $("#Layout-Modal").modal({
                backdrop: 'static',
                keyboard: false
            });

            $.post("/Common/LimsVersion", {
            }, function (datas) {
                $("#Layout-Modal-Embed").html(datas);
            });
        });
    </script>
</body>
</html>